// KS0108.h
#ifndef		KS0108_H
#define		KS0108_H	1

#include	<stdint.h>
#include	"Pin.h"
#include	"Bus.h"

// LCD Hadrware Abstraction Layer

#define		KS0108_POWER_ON		0x00CF
#define		KS0108_POWER_OFF	0x00CE
#define		KS0108_X			0x0040
#define		KS0108_Y			0x00B8
#define		KS0108_LINE			0x00C0


#define		KS0108_POWER_MASK	0x0001
#define		KS0108_X_MASK		0x003F
#define		KS0108_Y_MASK		0x0007
#define		KS0108_LINE_MASK	0x003F
#define		KS0108_DATA_MASK	0x00FF
#define		KS0108_BUSY			0x80
#define		KS0108_RESET		0x10


struct sKS0108{
	struct sPin cs, en, rw, rs;
	struct sBus db;
};

uint8_t KS0108Open( struct sKS0108 *this );
uint8_t KS0108Close( struct sKS0108 *this );
void 	KS0108Write( struct sKS0108 *this, uint8_t data );
void	KS0108WriteData( struct sKS0108 *this, uint8_t data );
uint8_t KS0108Read( struct sKS0108 *this );
uint8_t KS0108ReadData( struct sKS0108 *this );

#endif	// #ifndef		KS0108_H
